package 双指针;

/**
 * @author TTDB
 * @create 2025/9/13
 */
public class moveZeroes {
    public void moveZeroes(int[] nums) {
        int slow = 0;
        //int fast = 0;
        for(int fast = 0; fast < nums.length; fast++){
            if(nums[fast] != 0){
                nums[slow] = nums[fast];
                slow++;
            }
        }
        while(slow < nums.length){
            nums[slow] = 0;
            slow++;
        }
        return;
    }
}
